package atshool.ruanjian.erban.Service;

import atshool.ruanjian.erban.Entity.Page;
import atshool.ruanjian.erban.Entity.test;
import atshool.ruanjian.erban.mapper.testMapper;
import org.junit.platform.commons.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
public class testService {

    @Autowired
   private testMapper mapper;

    @Transactional(readOnly = false)
    public void save (test test) {
        if(StringUtils.isBlank(test.getId())) {
            mapper.insert(test);
        } else {
            mapper.update(test);
        }
    }
    public Page findPage (test test,String no) {
        test.setPage(no);
       return new Page().setList((List) mapper.findList(test)) ;
    }
    @Transactional(readOnly = false)
    public void delete(String id) {
        mapper.delete(id);
    }

}
